<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <body>

        <ui:composition template="./LogInTemplate.xhtml">

            <ui:define name="top">
                <p:panel>
                    <br/><h1><h:outputText value="Assign new Scholarship"/></h1>
                    <br/>
                    <br/>
                </p:panel>
            </ui:define>

            <ui:define name="content">
                <p:panel>
                    <f:view>
                        <h:form>
                            
                            <h:panelGrid columns="2">
                                <p:outputLabel value="Date: " for="date" />
                                <p:calendar id="date" value="#{assignScholarshipBean.assignScholarship.date}" />
                                
                                <p:outputLabel value="Id Student: " for="idStudent" />
                                <p:selectOneMenu id="idStudent" value="#{assignScholarshipBean.studentSelected}" 
                                                 required="true" requiredMessage="The Id Student field is required.">
                                    <f:selectItems value="#{studentBean.studentList}" var="item" itemLabel="#{item.name} #{item.firstname} #{item.lastname}" itemValue="#{item.id}"/>
                                </p:selectOneMenu>
                                <p:outputLabel value="Id Scholarship: " for="idScholarship" />
                                <p:selectOneMenu id="idScholarship" value="#{assignScholarshipBean.schoarshipSelected}" 
                                                 required="true" requiredMessage="The Id Scholarship field is required.">
                                    <f:selectItems value="#{scholarshipBean.scholarshipList}" var="item" itemLabel="#{item.scholarshipTipe}" itemValue="#{item.id}"/>
                                </p:selectOneMenu>
                                <p:commandButton ajax="false" value="Accept" action="#{assignScholarshipBean.processSelection}"/>
                                <p:commandButton value="Cancel" action="AssignScholarshipList" immediate="true"/>
                            </h:panelGrid>
                        </h:form>
                    </f:view>

                </p:panel>
            </ui:define>

        </ui:composition>

    </body>
</html>
